package com.study.annotation.demo.aop;

import com.study.annotation.demo.Sensitive;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * 利用切面处理
 */
@Aspect
@Component
public class SensitiveProcessor {


    @Pointcut("@annotation(com.study.annotation.demo.Sensitive2)")
    public void rep(){}

    @Pointcut("rep()")
    public Object around(ProceedingJoinPoint proceedingJoinPoint)throws Throwable{
        Object proceed = proceedingJoinPoint.proceed();
        System.out.println(proceed.toString());
        return null;
    }

    @Pointcut("execution(* com.study.annotation.demo.service.Serivce(..))")
    public void rep2(){}

  /*  @Before("rep2()")
    public Object around1(ProceedingJoinPoint proceedingJoinPoint)throws Throwable{
        Object proceed = proceedingJoinPoint.proceed();
        System.out.println(proceed.toString());
        return null;
    }*/
/*
  @Before("rep2()")
  public void berafo(){
      System.out.println("ok");
  }*/

}
